#!/usr/bin/env python
# -*- coding: utf8 -*-

#-------------------------------------------------------------------------------
# Name:        module1
# Purpose:
#
# Author:      iori
#
# Created:     21/02/2014
# Copyright:   (c) iori 2014
# Licence:     <your licence>
#-------------------------------------------------------------------------------

import string
import random

def random_string(length, charset=''):
    ''' 生成指定长度的由字母和数字组成的串'''

    if not charset:
        charset = string.ascii_uppercase + string.digits + string.ascii_lowercase
    return ''.join(random.choice(charset) for _ in range(length))



# A decorator function that takes care of starting a coroutine
# automatically on call.
def coroutine(func):
    ''' A decorator function that takes care of starting a coroutine
    automatically on call.'''
    def start(*args,**kwargs):
        cr = func(*args,**kwargs)
        cr.next()
        return cr
    return start

def main():
    pass

if __name__ == '__main__':
    main()
